package day12.Stream;

import java.util.ArrayList;
import java.util.Objects;
import java.util.function.Consumer;
import java.util.stream.Stream;

public class Test1 {
    public static void main(String[] args) {
        ArrayList<String> list1 = new ArrayList<>();
        list1.add("周润发");
        list1.add("成龙");
        list1.add("刘德华");
        list1.add("吴京");
        list1.add("周星驰");
        list1.add("李连杰");


        ArrayList<String> list2 = new ArrayList<>();
        list2.add("林心如");
        list2.add("张曼玉");
        list2.add("林青霞");
        list2.add("柳岩");
        list2.add("林志玲");
        list2.add("王祖贤");

        Stream<String> limit = list1.stream().filter(s -> s.length() == 3).limit(2);
        Stream<String> lin = list2.stream().filter(s -> s.startsWith("林")).skip(1);
        Stream<String> concat = Stream.concat(limit, lin);
        concat.forEach(new Consumer<String>() {
            @Override
            public void accept(String name) {
                actor actor = new actor(name);
                System.out.println(actor);
            }
        });
    }

}

class actor{
    private String name;

    public actor() {
    }

    public actor(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }



    @Override
    public String toString() {
        return "actor{" +
                "name='" + name + '\'' +
                '}';
    }
}

